var app = getApp();

Page({
  data: {
    order: null,
    shopdata: null,
    storedata: null,
    payType:''
    // getGoodsTotalPrice: function() {
    //   return this.data.order.total_price;
    // }
  },
  onLoad: function(t) {
    console.log(t)
    var oid = t.oid,
      that = this
    // wx.showLoading({
    //     title: "正在加载"
    //   }),
      app.getData({
        url: app.api.getOrder(oid),
        method: 'GET',
        ok: function(res) {
          console.log(res)
          if (res.statusCode == 200 && res.errMsg == "request:ok") {
            if (res.data.code == 1) {
              if (res.data.data.shopManagers == null || res.data.data.shopManagers==''){
                that.setData({
                  order: res.data.data,
                  shopdata: res.data.data.hyOrderGoods[0],
                  payType: res.data.data.payType
                })
              }else{
                that.setData({
                  order: res.data.data,
                  shopdata: res.data.data.hyOrderGoods[0],
                  storedata: res.data.data.shopManagers,
                  payType: res.data.data.payType
                })
              }
              
            }
          }
        }
      })
  },
  copyText: function(t) {
    var o = t.currentTarget.dataset.text;
    wx.setClipboardData({
      data: o,
      success: function() {
        wx.showToast({
          title: "已复制"
        });
      }
    });
  },
  location: function() {
    var t = this.data.mdinfo.coordinates.split(","),
      o = this.data.mdinfo;
    console.log(t), wx.openLocation({
      latitude: parseFloat(t[0]),
      longitude: parseFloat(t[1]),
      address: o.address,
      name: o.name
    });
  }
});